<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style_css/normalize.css">
    <link rel="stylesheet" href="style_css/login2.css">
    <link rel="shortcut icon" href="img/logo.ico" type="image/x-icon">
    <link rel="icon" href="img/logo.ico" type="image/x-icon">
    <script>
       function check(){
           var username = document.getElementById("username").value;
           var password = document.getElementById("password").value;
           if(username == "admin" && password == "admin"){
               return true;
           } 
           else if(username == ""){
               alert("用户名为空");
               return false;
           }else if(password ==""){
               alert("密码为空");
               return false;
           }else{
               alert("用户名或密码错误");
               return false;
           }
       }
       
        document.onkeydown = keyDown;
        function keyDown(e) {
        // 当按下回车键，执行我们的代码
            if (e.keyCode == 13) {
               document.getElementById("loginbtn").click();
            }
        }
    </script>
    <title>小米账号—爱生活，爱科技</title>
</head>
<body onkeydown="KeyLogin();">
    <div class="content">
        <div class="login-box">
            <h1>SIGN IN</h1>
            <div class="output-frame">
                <label for="username">账号</label>
                <input type="text" id="username" autofocus>
            </div>
            <div class="output-frame">
                <label for="password">密码</label>
                <input type="password" id="password">
            </div>
            <a href="success.html" target="_self">
                <button class="login-btn" id="loginbtn" onclick="return check(this.form);">登录</button>
            </a>
        </div>
    </div>
</body>
</html>